package org.dromara.tearoom.controller;


import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.vo.CityVo;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.tearoom.domain.bo.TerAgreementBo;
import org.dromara.tearoom.domain.bo.TerRegionalInfoBo;
import org.dromara.tearoom.domain.bo.TerRoomDetailsBo;
import org.dromara.tearoom.domain.vo.TerAgreementVo;
import org.dromara.tearoom.domain.vo.TerRegionalInfoVo;
import org.dromara.tearoom.domain.vo.TerRoomDetailsVo;
import org.dromara.tearoom.service.ITerAgreementService;
import org.dromara.tearoom.service.ITerRegionalInfoService;
import org.dromara.tearoom.service.ITerRoomDetailsService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 不校验登录 Controller
 * @author CKJ
 * @description: 不校验登录
 * @date 2025/7/7 16:23
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/ignore-login")
public class IgnoreLoginController {
    private final ITerRegionalInfoService terRegionalInfoService;
    private final ITerRoomDetailsService terRoomDetailsService;
    private final ITerAgreementService terAgreementService;


    /**
     * 根据门店查询已开通城市
     * @return
     */
    @GetMapping("/regionalInfo/getOpenCity")
    public R<List<CityVo>> getOpenCity() {
        return R.ok(terRegionalInfoService.getOpenCity());
    }

    /**
     * 根据区域和经纬度获取门店分页信息
     * @return
     */
    @GetMapping("/regionalInfo/getPageListByArea")
    public TableDataInfo<TerRegionalInfoVo> getPageListByArea(TerRegionalInfoBo bo, PageQuery pageQuery) {
        return terRegionalInfoService.queryAppPageList(bo,pageQuery);
    }

    /**
     * 分页查询茶室列表
     */
    @GetMapping("/roomDetails/app/page")
    public TableDataInfo<TerRoomDetailsVo> appPage(TerRoomDetailsBo bo, PageQuery pageQuery) {
        return terRoomDetailsService.queryPageList(bo, pageQuery);
    }

    /**
     * 查询协议描述
     * @param bo
     * @return
     */
    @GetMapping("/agreement/queryAgreement")
    public R<List<TerAgreementVo>> queryAgreement(TerAgreementBo bo) {
        return R.ok(terAgreementService.queryList(bo));
    }
}
